#include <QBoxLayout>
#include <QPushButton>

#include "pluginswidget.h"

PluginsWidget::PluginsWidget(QWidget *parent)
    : QDialog(parent)
{
    QVBoxLayout * mainLayout = new QVBoxLayout(this);
    mainLayout->setContentsMargins(0, 0, 0, 0);
    mainLayout->setSpacing(4);

    m_listWidget = new QListWidget(this);
    m_listWidget->setMinimumSize(400, 500);
    mainLayout->addWidget(m_listWidget, 1);

    QHBoxLayout * buttonLayout = new QHBoxLayout(this);
    buttonLayout->setContentsMargins(0, 0, 0, 0);
    QPushButton * closeButton = new QPushButton(tr("Close"), this);
    buttonLayout->addWidget(closeButton);
    buttonLayout->addStretch(1);
    mainLayout->addLayout(buttonLayout);
    connect(closeButton, SIGNAL(clicked()), this, SLOT(reject()));

    setLayout(mainLayout);
}

void PluginsWidget::addPlugin(const QString & name)
{
    m_listWidget->addItem(name);
}
